#include <stdio.h>
#include <chrono>
#include <unistd.h>
#include <fcntl.h>
#include <fstream>
#include <vector>
#include <filesystem>
#include "Util/logc.h"
#include "A20Device.h"


using  namespace  HidDeviceNameSpace;

A20Device::A20Device(const std::string& device_path, std::string& product_model, const std::string& product_name, const std::string& phy_version, 
        const std::string& soft_version, const std::string& serial_number, 
        const std::string& unique_id, std::vector<HidDevInfo> sub_devices):HidDevice(device_path, product_model, product_name, phy_version, 
        soft_version, serial_number, unique_id, sub_devices){
   
    m_upgrade = std::make_shared<DeviceUpgradeUtil>(A20SERIES);
}

A20Device::~A20Device(){
    
}


bool A20Device::Upgrade(const std::string& file_path){
    std::lock_guard<std::recursive_mutex> guard(m_mux);
    m_upgrade->setDigitalTotal(1 + m_sub_devices.size());
    return m_upgrade->Upgrade(m_device_file_path, file_path);
}



